import { request } from '@/utils/request';
import type { codeType, User, UserInfo,PatientList ,Patient} from '@/types/user'


//封装用户登良接口
export const loginByPassword=(mobile:string,password:string)=>{
   return  request<User>('/login/password',"post",{mobile,password})
}
//封装发送短信接口

export const sendCodeAPI = (mobile:string,type:codeType)=>{
    return request<User>('/code',"get",{mobile,type})
}

//短信验证码登录接口
export const loginByCodeAPI = (mobile:string,code:string)=>{
    return request<User>('/login',"post",{mobile,code})
}

//获取个人信息
export const getUserInfoAPI = ()=> request<UserInfo>('/patient/myUser','get')

//获取患者信息列表
export const getPatientListAPI = ()=>{
    return request<PatientList>('/patient/mylist','get')
}
// 添加患者信息
export const addPatient = (patient: Patient) => request('/patient/add', 'POST', patient)
// 编辑患者信息
export const editPatient = (patient: Patient) => request('/patient/update', 'PUT', patient)
// 删除患者信息
export const delPatient = (id: string) => request(`/patient/del/${id}`, 'DELETE')
// 查询患者详情
export const getPatientDetail = (id: string) => request<Patient>(`/patient/info/${id}`)
